#pragma once

#include "ofMain.h"

#include "FTGL/ftgl.h"

#include "Twitter.h"

class testApp;

class TwitterListener : public rt::IEventListener
{
	public:

        void setup(testApp * _app)
        {
            app = _app;
        }

        virtual void onStatusUpdate(const rtt::Tweet& tweet);

        virtual void onStatusDestroy(const rtt::StatusDestroy& destroy)
		{
			printf("stream destroy");
        }

        virtual void onStreamEvent(const rtt::StreamEvent& event)
		{
			printf("stream event");
        }

        testApp * app;
};

class testApp : public ofBaseApp
{
	public:
		void setup();
		void update();
		void draw();

		void keyPressed(int key);
		void keyReleased(int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);
		void windowResized(int w, int h);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);

	private:
		void newTweetEvent(rtt::Tweet tweet);

		//ofTrueTypeFont font;
		FTGLPixmapFont *ftglFont;

		vector<string> texts;

		rt::Twitter twitter;
		rt::Stream *stream;
		TwitterListener listener;

		friend class TwitterListener;
};

